package jhunter.rt;

import jhunter.JHunterConfConfig;
import jhunter.conf.io.AppsXmlLoader;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class JHunterSpringContext {

	private static AnnotationConfigApplicationContext context;

	private static Object object = new Object();

	public static AnnotationConfigApplicationContext getJHunterSpringContext() {
		if (context == null) {
			synchronized (object) {
				context = new AnnotationConfigApplicationContext();
				context.register(JHunterConfConfig.class);
				context.scan(AppsXmlLoader.class.getPackage().getName(), DefaultJHunterContainer.class.getPackage().getName());
				context.refresh();
			}
		}
		return context;
	}

}
